package cn.northsea.mapper;

import cn.northsea.entity.Seek;
import cn.northsea.entity.SeekDz;
import cn.northsea.entity.SeekUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserMapper extends BaseMapper<SeekUser> {
    @Select("select * from seek_user where username=#{username}")
    SeekUser getUserByUserName(SeekUser user);
//    @Insert("insert into seek_user (username,`password`,`deleted`,`tenant_id`)\n" +
//            "    values (#{username},#{password},0,#{tenantId})")
//    int addUser(SeekUser user);
    @Update("update seek_user set real_name=#{realName},email=#{email},phone=#{phone},address=#{address},money=#{money},job=#{job},avatar=#{avatar},create_time=#{createTime} where user_id=#{userId}")
    void addInformation(SeekUser user);
    @Select("select job from seek_user where username=#{username}")
    SeekUser findJobByName(String username);
    @Select("select * from seek_user where username=#{username}")
    SeekUser findUserByName(String username);
    @Select("select * from seek_user")
    List<SeekUser> findAll();
    @Insert("insert into seek_user (username,`password`,`create_time`,`deleted`,`tenant_id`)\n" +
            "    values (#{username},#{password},#{createTime},0,#{tenantId})")
    void register(SeekUser user);
    @Select("select * from seek_dz where uid=#{uid}")
    List<SeekDz> userfirend(Integer uid);
    @Select("select * from seek_user where user_id=#{toid}")
    SeekUser findByUserid(Integer toid);
}
